from . import app
from pyrogram.types.messages_and_media import Message


async def find_history_message(message: Message, offset_id=None):
    if not offset_id:
        offset_id = message.reply_to_message.id
    async for m in app.get_chat_history(message.chat.id, offset_id=offset_id):
        if m.from_user and m.from_user.id == message.reply_to_message.from_user.id:
            return m
